<template>
	<view class="box">
		<view class="top_box">
			<view class="img_box">
				<image :src="trademarkInfo.mark_descriptions" alt="" class="shbao_img" mode="aspectFit"></image>
			</view>
			<view class="shbao_name el">{{trademarkInfo.shangbiao_name}}</view>
			<view class="price" v-if="trademarkInfo.is_price==1"> <text>¥</text> {{trademarkInfo.cost}} </view>
		</view>
		<view class="details_box">
			<!-- <view class="title_text"> 商标详情</view> -->
			<!-- <view class="item">
				<view class="item_title">译&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;文:</view>
				<view class="item_right">{{trademarkInfo.shangbiao_name_en}}</view>
			</view> -->
			<view class="item">
				<view class="item_title">类&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;别:</view>
				<view class="item_right">{{trademarkInfo.category}}-{{trademarkInfo.categoryNoToStr}}</view>
			</view>
			<!-- <view class="item">
				<view class="item_title">注&nbsp;册&nbsp;号:</view>
				<view class="item_right">{{trademarkInfo.register_no}}</view>
			</view> -->
			<view class="item">
				<view class="item_title">有&nbsp;效&nbsp;期:</view>
				<view class="item_right">{{trademarkInfo.chusheng_gonggao_date1}}-{{trademarkInfo.daoqi_date}}</view>
			</view>
			<view class="item">
				<view class="item_title"> 群&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;组:</view>
				<view class="item_right">{{trademarkInfo.select_group}}</view>
			</view>
			<view class="item" style="align-items: flex-start;">
				<view class="item_title"> 小&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;项:</view>
				<view class="item_right" style="line-height:40rpx;">{{trademarkInfo.service_project}}</view>
			</view>
		</view>
		<view class="hr"></view>
		<view class="equally_box">
			<view class="title_text">同名{{cate_str.length}}类</view>
			<view class="equally_list">
				<text class="equally_liem" v-for="(item,index) in cate_str" :key="index" :class="index==equally?'on':''"
					@click="changeIndex(index)">{{item.category}}</text>
			</view>
			<view class="equally_text">
				{{cate_str[equally].name}}
			</view>
		</view>

		<!-- <view class="customerService_box">
			<view class="kf_box">
				<image :src="wx.re_pic" class="kf_img"></image>
				<view class="right_box">
					<view class="title">{{wx.name}}</view>
					<view class="mobile">
						<image src="https://res.huibiaow.cn/xcx_cyolw/index/2.png" class="mobile_icon"></image>
						<view class="mobile_text">{{wx.tel}}</view>
					</view>
					<image :src="wx.r_code" class="r_code_img"></image>
				</view>
			</view>
		</view> -->
		<view style="height: 100rpx;"> </view>
		<view class="btn_box">
			<view class="btn" @click="expertConsultation()" v-if="tabBarShow">
				<image src="https://res.huibiaow.cn/xcx_cyolw/index/kf_icon.png" class="kf_icon"></image>
				<view class="kf_text">联系我们</view>
			</view>
			<view class="btn" @click="ToIndex()" v-if="!tabBarShow">
				<view class="kf_text">前往首页</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id: '',
				trademarkInfo: '',
				cate_str: [],
				wx: '',
				cate_count: '',
				equally_text: "",
				equally: 0,
				tabBarShow: this.$store.state.tabBarShow
			}
		},
		onLoad(options) {
			this.id = options.id;
		},
		onShow() {
			this.getTrademarkInfo()
		},
		onShareAppMessage(res) {
			let _this = this;
			if (res.from === 'button') { // 来自页面内分享按钮 
				if (res.target.dataset.name === 'shareBtn') {
					return {
						title: '商标详情',
						path: '/subHomePage/trademarkDeatils/trademarkDeatils?id=' + _this.trademarkInfo.id,
					}
				}
			}
			if (res.from === "menu") { // 来自页面右上角分享 
				return {
					title: '商标详情',
					path: '/subHomePage/trademarkDeatils/trademarkDeatils?id=' + _this.trademarkInfo.id,
				}
			}
		},
		methods: {
			changeIndex(i) {
				this.equally = i;
			},
			async getTrademarkInfo() {
				this.$request({
						url: 'index/index/trademark_info',
						data: {
							id: this.id,
							source_site: 1
						},
						success: (res) => {
							if (res.code == 0) {
								this.trademarkInfo = res.data.trademark;
								this.cate_str = res.data.cate_str;
								this.wx = res.data.wx;
								this.cate_count = res.data.cate_count;
								this.equally_text = res.data.cate_str[0].name;
							} else {
								uni.showToast({
									title: res.msg,
									icon: 'none'
								});
							}
						}
					},
					false
				);
			},
			//跳转到微信客服
			expertConsultation() {
				uni.switchTab({
					url: '/pages/BusinessCard/BusinessCard'
				});
				// wx.openCustomerServiceChat({
				// 	extInfo: {
				// 		url: 'https://work.weixin.qq.com/kfid/kfcf6d12abc1bc978ac'
				// 	},
				// 	corpId: 'ww5dd97fa44d21426f',
				// 	showMessageCard: true,
				// 	sendMessageTitle: _this.trademarkInfo.shangbiao_name,
				// 	sendMessagePath: 'subHomePage/trademarkDetails/trademarkDetails.html?id=' + _this.trademarkInfo
				// 		.id,
				// 	sendMessageImg: _this.trademarkInfo.mark_descriptions,
				// 	success(res) {
				// 		console.log('成功打开客服聊天界面');
				// 	},
				// 	fail(err) {
				// 		console.log('打开客服聊天界面失败', err);
				// 	}
				// })
			},
			ToIndex() {
				uni.switchTab({
					url: '/pages/index/index'
				});
			}
		}
	}
</script>

<style lang='scss'>
	page {
		background: #F5F6FA;
	}

	.box {
		background: url(https://res.huibiaow.cn/file/20250710/17521094788424.png) no-repeat;
		background-size: 100% auto;
		overflow: hidden;

		.top_box {
			/* width: 750rpx; */
			background-color: #fff;
			margin: 21rpx 30rpx;
			margin-bottom: 0rpx;
			overflow: hidden;

			.img_box {
				width: 100%;
				background: #fff;
				border-radius: 10rpx;
				border: 1px solid #DFE3E5;
				display: flex;
				flex-direction: column;
				flex-wrap: nowrap;
				align-content: center;
				justify-content: center;
				align-items: center;
				width: 655rpx;
				height: 655rpx;
				margin: 24rpx 24rpx 0;

				.shbao_img {
					max-width: 100%;
					max-height: 100%;
				}
			}

			.shbao_name {
				font-family: PingFang SC;
				font-weight: 800;
				font-size: 48rpx;
				color: #333333;
				padding: 20rpx 0rpx;
				text-align: center;
			}

			.price {
				font-family: Alibaba PuHuiTi;
				font-weight: bold;
				font-size: 36rpx;
				color: #FF4B21;
				text-align: center;
				margin: 0 24rpx;
				padding-bottom: 30rpx;
				border-bottom: 1px solid #DFE3E5;

				text {
					font-size: 36rpx;
				}
			}
		}

		.details_box {
			background: #FFFFFF;
			margin: 0rpx 30rpx;
			padding: 25rpx 32rpx 27rpx 25rpx;

			.title_text {
				font-family: PingFang SC;
				font-weight: 500;
				font-size: 30rpx;
				color: #333333;
				margin-bottom: 30rpx;
			}

			.item {
				display: flex;
				flex-direction: row;
				justify-content: flex-start;
				align-items: center;
				flex-wrap: nowrap;
				margin-bottom: 20rpx;

				.item_title {
					width: 105rpx;
					font-family: PingFang SC;
					font-weight: 400;
					font-size: 24rpx;
					color: #7C889C;
					margin-right: 15rpx;
				}

				.item_right {
					font-family: PingFang SC;
					font-weight: 400;
					font-size: 24rpx;
					color: #333333;
				}
			}
		}

		.hr {
			margin: 0 48rpx;
			height: 1px;
			background-color: #DFE3E5;
			width: calc(100% - 96rpx);
		}

		.equally_box {
			background: #FFFFFF;
			margin: 0rpx 30rpx 85rpx;
			padding: 30rpx 29rpx;

			.title_text {
				font-family: PingFang SC;
				font-weight: bold;
				font-size: 30rpx;
				color: #E83030;
				text-align: center;
				margin: 0rpx auto 30rpx auto;
			}

			.equally_list {
				overflow-x: auto;
				width: 100%;
				white-space: nowrap;

				.equally_liem {
					display: inline-block;
					font-family: PingFang SC;
					font-weight: 400;
					font-size: 24rpx;
					color: #333333;
					width: 120rpx;
					text-align: center;
					line-height: 60rpx;
					background-color: #fff;
					border: 1rpx solid #DFE3E5;
					border-radius: 5rpx;
					margin-right: 20rpx;

					&.on {
						background-color: #FF3838;
						color: #fff;
					}
				}
			}

			.equally_text {
				margin-top: 30rpx;
				font-size: 24rpx;
				line-height: 48rpx;
				color: #333333;
			}
		}

		.customerService_box {
			background: #FFFFFF;
			padding: 30rpx 30rpx;
			margin-bottom: 20rpx;

			.kf_box {
				background: linear-gradient(-90deg, #F8F4F1 0%, #E7D9CE 100%);
				border-radius: 10rpx;
				display: flex;
				flex-direction: row;
				justify-content: flex-start;
				align-items: flex-start;
				flex-wrap: nowrap;
				padding: 40rpx 30rpx 40rpx 30rpx;

				.kf_img {
					width: 240rpx;
					height: 240rpx;
					margin-right: 50rpx;
				}

				.right_box {
					.title {
						font-family: PingFang SC;
						font-weight: 800;
						font-size: 30rpx;
						color: #333333;
						margin-bottom: 15rpx;
					}

					.mobile {
						display: flex;
						flex-direction: row;
						justify-content: flex-start;
						align-items: center;
						flex-wrap: nowrap;
						margin-bottom: 5rpx;

						.mobile_icon {
							width: 22rpx;
							height: 25rpx;
							margin-right: 10rpx;
						}

						.mobile_text {
							font-family: PingFang SC;
							font-weight: 800;
							font-size: 30rpx;
							color: #333333;
						}
					}

					.r_code_img {
						width: 150rpx;
						height: 150rpx;
					}
				}
			}
		}

		.btn_box {
			background: #FFFFFF;
			position: fixed;
			bottom: 0rpx;
			left: 0rpx;
			width: 100%;
			padding-bottom: 20rpx;
			height: 140rpx;
			display: flex;
			align-items: center;

			.btn {
				width: 100%;
				background: linear-gradient(90deg, #FF3838 0%, #FF2525 100%);
				display: flex;
				flex-direction: row;
				justify-content: center;
				align-items: center;
				flex-wrap: nowrap;
				border-radius: 40rpx;

				.kf_icon {
					width: 30rpx;
					height: 30rpx;
					margin-right: 10rpx;
				}

				.kf_text {
					font-family: PingFang SC;
					font-weight: bold;
					font-size: 30rpx;
					color: #FFFFFF;
					height: 80rpx;
					line-height: 80rpx;
					text-align: center;
				}

			}
		}
	}
</style>